#!/system/bin/sh
all_lists=($(sqlite3 /data/service/el1/public/bms/bundle_manager_service/bmsdb.db "SELECT KEY FROM 'installed_bundle'"))
for item in "${all_lists[@]}"; do
    sqlite3 /data/service/el1/public/bms/bundle_manager_service/bmsdb.db "SELECT value FROM installed_bundle WHERE key = '${item}'" | jq -r --arg pkg "${item}" '(.baseApplicationInfo.hideDesktopIcon // false) as $hide | (.baseApplicationInfo.keepAlive // false) as $keep | select($hide == false and $keep == false) | .bundlePackInfo.summary.modules[].abilities[] | select(.visible == true) | "aa start -b \($pkg) -a \(.name)"' | while read -r cmd; do (echo "$cmd") done
done